/**
 * Prototype、__proto__、Constructor、Object、Function
 *
 */


class Demo {
  
  constructor(coffee) {
    this.coffee = coffee || 'coffee'
  }

  getCoffee() {
    return this.coffee
  }

}



class DemoEx extends Demo {
  constructor(coffee) {
    super(coffee);
    this.coffee = coffee || 'coffeeEx'  
  } 
  
  getMyCoffee() {
    return this.coffee
  } 

}


const demo = new Demo()
const demoEx = new DemoEx()

// Constructor
console.log('Demo.prototype.contructor === DemoEx.prototype.contructor:', 
  Demo.prototype.constructor === DemoEx.prototype.constructor)

console.log('Demo.prototype.contructor === Demo', 
  Demo.prototype.constructor === Demo, '\n')

console.log('Demo.prototype.getCoffee === DemoEx.prototype.getCoffee:', 
  Demo.prototype.getCoffee === DemoEx.prototype.getCoffee)

console.log('demo.__proto__.constructor === Demo:', 
  demo.__proto__.constructor === Demo, '\n')

console.log('demo.__proto__.getCoffee === Demo.prototype.getCoffee:',
  demo.__proto__.getCoffee === Demo.prototype.getCoffee, '\n')

console.log('demo.__proto__.contructor === Demo.prototype.constructor:', 
  demo.__proto__.constructor === Demo.prototype.constructor, '\n')

console.log('demoEx.__proto__.contructor === Demo.prototype.contructor:', 
  demoEx.__proto__.constructor === Demo.prototype.constructor)

console.log('demo.__proto__.getCoffee === demoEx.__proto__.getCoffee', 
  demo.__proto__.getCoffee === demoEx.__proto__.getCoffee, '\n')

console.log('demo.__proto__.getMyCoffee === demoEx.__proto__.getMyCoffee', 
  demo.__proto__.getMyCoffee === demoEx.__proto__.getMyCoffee)

console.log('demo.__proto__.getCoffee === Demo.prototype.getCoffee', 
  demo.__proto__.getCoffee === Demo.prototype.getCoffee)


console.log('Object:  ', Object)
console.log('Object.prototype:  ', Object.prototype)
console.log('Object.__proto__:  ', Object.__proto__)
console.log('Object.prototype.prototype:  ', Object.prototype.prototype)
console.log('Object.prototype.__proto__:  ', Object.prototype.__proto__)
console.log('Object.__proto__.prototype:  ', Object.__proto__.prototype, '\n')

console.log('Function:  ', Function)
console.log('Function.prototype:  ', Function.prototype)
console.log('Function.__proto__:  ', Function.__proto__)
console.log('Function.prototype.prototype:  ', Function.prototype.prototype)
console.log('Function.prototype.__proto__:  ', Function.prototype.__proto__)
console.log('Function.__proto__.prototype:  ', Function.__proto__.prototype, '\n')


console.log('Object.constructor === Function: ', Object.constructor === Function)

console.log(Object instanceof Function)
console.log(Function instanceof Object)
